package zhibi.service.impl;

import org.apache.catalina.security.SecurityUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import zhibi.domain.User;
import zhibi.extra.base.BaseServiceImpl;
import zhibi.mapper.UserMapper;
import zhibi.service.UserService;
import zhibi.utils.security.SecurityUtils;

/**
 * Created by 执笔 on 2018/3/24.
 */
@Service
@Transactional
public class UserServiceImpl extends BaseServiceImpl<User> implements UserService {

    @Autowired
    public UserServiceImpl(UserMapper mapper) {
        super(mapper);
    }
    @Autowired
    private UserMapper userMapper;

    @Override
    public User login(String username, String password) {
        User user = new User();
        user.setPassword(SecurityUtils.MD5(password).toUpperCase());
        user.setUsername(username);
        return userMapper.selectOne(user);
    }
}
